import {
  mapGetters
} from 'vuex';

export default {
  computed: {
    ...mapGetters('cart', ['cartSUM'])
  },
  onShow: function() {
    this.setBadge();
  },
  watch:{
    cartSUM(newValue){
      uni.setTabBarBadge({
        index: 2,
        text: newValue + ''
      })
    }
  },
  methods: {
    setBadge() {
      uni.setTabBarBadge({
        index: 2,
        text: this.cartSUM + ''
      })
    }
  }
}
